@import "../../../_public/less/_core.less";

/**
 * 导航
 */
@nav_height: 55px;
.app-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: @nav_height;
  z-index: 1000;
  .nav {
    a {
      display: inline-block;
      height: @nav_height - 2;
      margin-right: 1em;
      padding: 0 1em;
      border-bottom: 2px solid #fff;
      outline: none;
      overflow: hidden;
      line-height: @nav_height;
      color: #333;
      text-align: center;
      font-size: 14px;
      .transition(.2s);
      &.cur,
      &.cur:hover {
        border-bottom-color: currentColor;
        color: #ff9800;
      }
      &:hover {
        color: #ff9800;
      }
    }
  }
  .nav-app-name {
    display: block;
    width: 100px;
    height: @nav_height;
    background: url('../images/nav-logo.png') no-repeat center;
    background-size: 95px 28px;
  }
  .nav-more-btn {
    position: absolute;
    display: block;
    width: 42px;
    height: 42px;
    border-radius: 4px;
    cursor: default;
    background: #fff;
    i {
      display: block;
      position: absolute;
      width: 26px;
      height: 4px;
      left: 9px;
      border-radius: 4px;
      background: #444;
      &:nth-child(1) {
        top: 10px
      }
      &:nth-child(2) {
        top: 19px
      }
      &:nth-child(3) {
        top: 28px
      }
    }
  }
}

@media screen and (min-width: 660px) {
  .app-nav {
    .nav {
      float: right;
      text-align: right;
    }
    .nav-app-name {
      float: left;
    }
    .nav-more-btn {
      top: 15px;
      right: 20px;
      z-index: 1;
      transform: translate(0, 0);
      .transition(.2s, ease-out);
      transition-delay: .5s;
    }
    .nav-body {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: @nav_height;
      background: #fff;
      opacity: 0;
      transform: translate(0, -10%);
      .transition(.2s, ease-out);
      transition-delay: .5s;
      visibility: hidden;
      z-index: 2;
    }
    &.darken,
    &:hover {
      .nav-more-btn {
        transform: translate(0, -100%);
        opacity: 0;
        transition-delay: .2s;
      }
      .nav-body {
        visibility: visible;
        transform: translate(0, 0);
        opacity: 1;
        box-shadow: 0 0 5px rgba(0, 0, 0, .4);
        transition-delay: .1s;
      }
    }
  }
}

@media screen and (max-width: 660px) {

  .app-container,
  .app-footer {
    .transition(.2s, ease);
  }

  .app-nav {
    height: @nav_height;
    .nav-more-btn {
      top: 8px;
      right: 20px;
      box-shadow: 1px 1px 4px rgba(0, 0, 0, .2);
      i {
        .transition(.2s)
      }
    }
    .nav-app-name {
      margin: auto;
    }
  }

  .nav-body {
    position: absolute;
    width: 100%;
    height: auto;
    top: 0;
    left: 0;
    background: #fff;
    box-shadow: 0 2px 2px rgba(0, 0, 0, .4);
    transform: translateY(-20px);
    opacity: 0;
    visibility: hidden;
    .transition(.2s, ease);
    .nav {
      margin: 10px 80px 20px;
      a {
        display: block;
        height: 40px;
      }
    }
  }

  .nav-slidedown {
    top: 15px;
    right: 20px;
    .nav-body {
      transform: translateY(0);
      visibility: visible;
      opacity: 1;
    }
    .nav-more-btn {
      i {
        &:nth-child(1) {
          transform: translateY(9px) rotate(-45deg);
        }
        &:nth-child(2) {
          opacity: 0;
        }
        &:nth-child(3) {
          transform: translateY(-9px) rotate(45deg);
        }
      }
    }
    .nav-mask {
      position: fixed;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
      z-index: 0;
    }
    .app-container,
    .app-footer {
      opacity: .4;
      .transform(translateY(100px));
    }
  }
}